package com.qidian.buy.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qidian.buy.entity.ItemCat;
import com.qidian.buy.product.mapper.ItemCatMapper;
import com.qidian.buy.product.service.IItemCatService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qidian.buy.util.pojo.BuyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 商品类目 服务实现类
 * </p>
 *
 * @author 戴着假发的程序员
 * @since 2023-05-18
 */
@Service
public class ItemCatServiceImpl extends ServiceImpl<ItemCatMapper, ItemCat> implements IItemCatService {
    @Autowired
    private ItemCatMapper itemCatMapper;
    @Override
    public BuyResult<ItemCat> queryByParentId(long parentId) {
        // 创建查询条件对象
        QueryWrapper<ItemCat> wrapper = new QueryWrapper<>();
        wrapper.eq("parent_id",parentId);
        return BuyResult.ok(itemCatMapper.selectList(wrapper));
    }
}
